package unit.blog;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.wo2record.blog.model.Article;
import com.wo2record.blog.model.ArticleTag;
import com.wo2record.blog.service.ArticleService;
import com.wo2record.user.model.UserLogin;

public class ArticleTestUtil {
	public static ArticleService getArticleService(){
		ApplicationContext ctx = new ClassPathXmlApplicationContext("app-context.xml");
		ArticleService articleService = (ArticleService)ctx.getBean("articleService");
		return articleService;
	}
	
	public static Article makeArticle(UserLogin user){
		Article article = new Article();
		article.setTitle("article title");
		article.setContent("article comment");
		article.setIsClose(false);
		article.setUserLogin(user);
		List<ArticleTag> articleTags = new ArrayList<ArticleTag>();
		article.setArticleTags(articleTags);
		return article;
	}
}
